package com.crm.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.crm.base.PageResult;
import com.crm.base.ResponseResult;
import com.crm.domain.entity.Notice;
import com.crm.service.NoticeService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@RequestMapping("/system/notice/pagelist")
public class NoticeController {
    private final NoticeService noticeService;

    @GetMapping("/{noticeId}")
    public PageResult getNotice(@PathVariable Long noticeId){
        Page<Notice> page = noticeService.lambdaQuery().eq(Notice::getNoticeId, noticeId).page(new Page<>(1, 10));
        return PageResult.success(String.valueOf(page.getTotal()), page.getRecords(),page.getCurrent());
    }
}
